Avoid a clone when creating BooleanArray from ArrayData#9159
Merged
Dandandan merged 1 commit intoapache:mainfrom Jan 14, 2026
Merged
Avoid a clone when creating BooleanArray from ArrayData#9159Dandandan merged 1 commit intoapache:mainfrom
BooleanArray from ArrayData#9159Dandandan merged 1 commit intoapache:mainfrom
Conversation
scovich
approved these changes
Jan 13, 2026
Comment on lines
398
to
+403
| assert_eq!( | ||
| data.buffers().len(), | ||
| buffers.len(), | ||
| 1, | ||
| "BooleanArray data should contain a single buffer only (values buffer)" | ||
| ); | ||
| let values = BooleanBuffer::new(data.buffers()[0].clone(), data.offset(), data.len()); | ||
| let buffer = buffers.pop().expect("checked above"); |
Contributor
There was a problem hiding this comment.
aside: it's a bit annoying that we can't just do let [buffer] = buffers else { ... }
(let [buffer] = buffers[..] else { ... } produces a slice ref that would match but only capture a borrow instead of consuming it like we want here)
Jefffrey
approved these changes
Jan 14, 2026
Dandandan
approved these changes
Jan 14, 2026
Contributor
|
Avoid all the clones! |
Dandandan
pushed a commit
to Dandandan/arrow-rs
that referenced
this pull request
Jan 15, 2026
# Which issue does this PR close? - Part of apache#9061 - broken out of apache#9058 # Rationale for this change Let's make arrow-rs the fastest we can and the fewer allocations the better # What changes are included in this PR? Apply pattern from apache#9114 # Are these changes tested? Existing tests # Are there any user-facing changes? No
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
make_array) #9061ArrayData(speed up reading from Parquet reader) #9058Rationale for this change
Let's make arrow-rs the fastest we can and the fewer allocations the better
What changes are included in this PR?
Apply pattern from #9114
Are these changes tested?
Existing tests
Are there any user-facing changes?
No